package com.suke.czx.modules.goods.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.suke.czx.common.validate.EnumValue;
import com.suke.czx.common.validate.GoodsSaveGroup;
import com.suke.czx.common.validate.GoodsUpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 应用模块名称: 物品
 * 代码描述: 物品实体
 * copyright: AUZAR ALL RIGHTS RESERVED
 * company: AUZAR
 *
 * @author: 颜米晨
 * @date: 2021/09/03 13:43:37
 */
@Data
@ApiModel(value = "物品管理")
@EqualsAndHashCode(callSuper = true)
public class Goods extends Model<Goods> {

    @ApiModelProperty(value = "物品id")
    @TableId(value = "goods_id", type = IdType.AUTO)
    @NotNull(groups = {GoodsUpdateGroup.class}, message = "物品编码不能为空")
    public Long goodsId;

    @ApiModelProperty(value = "物品名称")
    @NotBlank(groups = {GoodsSaveGroup.class, GoodsUpdateGroup.class}, message = "物品名称不能为空")
    public String goodsName;

    @ApiModelProperty(value = "品牌")
    @NotBlank(groups = {GoodsSaveGroup.class, GoodsUpdateGroup.class}, message = "品牌不能为空")
    public String brand;

    @ApiModelProperty(value = "参数")
    public String options;

    @ApiModelProperty(value = "单位")
    @NotBlank(groups = {GoodsSaveGroup.class, GoodsUpdateGroup.class}, message = "单位不能为空")
    public String unit;

    @ApiModelProperty(value = "数量")
    @NotNull(groups = {GoodsSaveGroup.class, GoodsUpdateGroup.class}, message = "数量不能为空")
    public BigDecimal count;

    @ApiModelProperty(value = "单价")
    @NotNull(groups = {GoodsSaveGroup.class, GoodsUpdateGroup.class}, message = "单价不能为空")
    public BigDecimal price;

    @ApiModelProperty(value = "类型（0经营管理采购 1项目合同 2计划采购 3实际采购 4交付清单）")
    @NotNull(groups = {GoodsSaveGroup.class, GoodsUpdateGroup.class}, message = "类型不能为空")
    @EnumValue(groups = {GoodsSaveGroup.class, GoodsUpdateGroup.class}, intValues = {0, 1, 2, 3, 4}, message = "物品类型只能是0,1,2,3,4")
    public Integer type;

    @TableField(exist = false)
    @ApiModelProperty(value = "类型名称")
    public String typeName;

    @ApiModelProperty(value = "产品类型（1硬件成品 2硬件定制 3软件成品 4软件定制 5影片 6其他）")
    @NotNull(groups = {GoodsSaveGroup.class, GoodsUpdateGroup.class}, message = "类型不能为空")
    @EnumValue(groups = {GoodsSaveGroup.class, GoodsUpdateGroup.class}, intValues = {1, 2, 3, 4, 5, 6}, message = "物品类型只能是1,2,3,4,5,6")
    public Integer goodsType;

    @TableField(exist = false)
    @ApiModelProperty(value = "产品类型名称")
    public String goodsTypeName;

    @ApiModelProperty(value = "项目id")
    public Long projectId;

    @ApiModelProperty(value = "供应商id")
    @NotNull(groups = {GoodsSaveGroup.class, GoodsUpdateGroup.class}, message = "供应商id不能为空")
    public Long supplierId;

    @TableField(exist = false)
    @ApiModelProperty(value = "供应商名称")
    public String supplierName;

    @ApiModelProperty(value = "合同id")
    public Long contractId;

    @ApiModelProperty(value = "关联id（采购类型和交付类型关联）")
    public Long relationId;

    @ApiModelProperty(value = "备注")
    public String note;

    @ApiModelProperty(value = "删除标记  0：删除   1：正常")
    public Integer del;

    @ApiModelProperty(value = "创建者id")
    public Long creator;

    @ApiModelProperty(value = "创建时间")
    public Date createTime;

    @ApiModelProperty(value = "更新者id")
    public Long updater;

    @ApiModelProperty(value = "更新时间")
    public Date updateTime;

}
